package com.liqi.deployment.service.impl;

import com.liqi.common.utils.DateUtils;
import com.liqi.deployment.domain.DvDeploymentModule;
import com.liqi.deployment.mapper.DvDeploymentModuleMapper;
import com.liqi.deployment.service.IDvDeploymentModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 部署设备模块Service业务层处理
 *
 * @author xiaoli
 * @date 2022-02-14
 */
@Service
public class DvDeploymentModuleServiceImpl implements IDvDeploymentModuleService
{
    @Autowired
    private DvDeploymentModuleMapper dvDeploymentModuleMapper;

    @Override
    public List<DvDeploymentModule> selectDvDeploymentModuleByDeviceId(String deviceId) {
        return dvDeploymentModuleMapper.selectDvDeploymentModuleByDeviceId(deviceId);
    }

    /**
     * 查询部署设备模块
     *
     * @param id 部署设备模块主键
     * @return 部署设备模块
     */
    @Override
    public DvDeploymentModule selectDvDeploymentModuleById(Long id)
    {
        return dvDeploymentModuleMapper.selectDvDeploymentModuleById(id);
    }

    @Override
    public List<DvDeploymentModule> selectDvDeploymentModuleByModelCode(String modelCode) {
        return dvDeploymentModuleMapper.selectDvDeploymentModuleByModelCode(modelCode);
    }

    /**
     * 查询部署设备模块列表
     *
     * @param DvDeploymentModule 部署设备模块
     * @return 部署设备模块
     */
    @Override
    public List<DvDeploymentModule> selectDvDeploymentModuleList(DvDeploymentModule DvDeploymentModule)
    {
        return dvDeploymentModuleMapper.selectDvDeploymentModuleList(DvDeploymentModule);
    }

    /**
     * 新增部署设备模块
     *
     * @param DvDeploymentModule 部署设备模块
     * @return 结果
     */
    @Override
    public int insertDvDeploymentModule(DvDeploymentModule DvDeploymentModule)
    {
        DvDeploymentModule.setCreateTime(DateUtils.getNowDate());
        return dvDeploymentModuleMapper.insertDvDeploymentModule(DvDeploymentModule);
    }

    /**
     * 修改部署设备模块
     *
     * @param DvDeploymentModule 部署设备模块
     * @return 结果
     */
    @Override
    public int updateDvDeploymentModule(DvDeploymentModule DvDeploymentModule)
    {
        DvDeploymentModule.setUpdateTime(DateUtils.getNowDate());
        return dvDeploymentModuleMapper.updateDvDeploymentModule(DvDeploymentModule);
    }

    @Override
	public int updateDeploymentModuleByDeviceIdAndModuleCode(DvDeploymentModule DvDeploymentModule) {
    	DvDeploymentModule.setUpdateTime(DateUtils.getNowDate());
        return dvDeploymentModuleMapper.updateDeploymentModuleByDeviceIdAndModuleCode(DvDeploymentModule);
	}

	/**
     * 批量删除部署设备模块
     *
     * @param ids 需要删除的部署设备模块主键
     * @return 结果
     */
    @Override
    public int deleteDvDeploymentModuleByIds(Long[] ids)
    {
        return dvDeploymentModuleMapper.deleteDvDeploymentModuleByIds(ids);
    }

    /**
     * 删除部署设备模块信息
     *
     * @param id 部署设备模块主键
     * @return 结果
     */
    @Override
    public int deleteDvDeploymentModuleById(Long id)
    {
        return dvDeploymentModuleMapper.deleteDvDeploymentModuleById(id);
    }
}
